import { _decorator, Component, Node, Slider, ProgressBar } from 'cc';
import { UIManager } from './UIManager';
const { ccclass, property } = _decorator;

@ccclass('UISetting')
export class UISetting extends Component {
    //bgm
    @property(Slider)
    sliderBgmVolume: Slider = null
    @property(ProgressBar)
    progressBgmVolume: ProgressBar = null

    //音效
    @property(Slider)
    sliderSfxVolume: Slider = null
    @property(ProgressBar)
    progressSfxVolume: ProgressBar = null


    start() {
        this.sliderBgmVolume.node.on("slide", this.onBgmVolumeChanged, this)
        this.sliderSfxVolume.node.on("slide", this.onSfxVolumeChanged, this)
    }

    update(deltaTime: number) {

    }
    OnBtnClose() {
        UIManager.instance.closeDialog()
    }
    onBgmVolumeChanged(slider: Slider) {
        this.progressBgmVolume.progress = slider.progress
    }
    onSfxVolumeChanged(slider: Slider) {
        this.progressSfxVolume.progress = slider.progress
    }
}


